package com.lijie.ljblog.controller;

import com.lijie.ljblog.model.Climate;
import com.lijie.ljblog.service.UtilService;
import com.lijie.ljblog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Title: ljblog_springboot
 * @Description: (天气控制方法)
 * @Author:lijie
 * @Version:1.1.0
 * @since 2021/11/4
 */
@RestController
@RequestMapping("/ljblog/weather")
public class WreatherController {
    @Autowired
    UtilService utilService;
    @RequestMapping("getWeather")
    public Result<Climate> getWeather(HttpServletRequest request){
//        return  utilService.getClimateByRequst(request);
        //测试代码：固定ip获得天气。
        Result<Climate> climateByIP = utilService.getClimateByRequst(request);
        return climateByIP;
    }

}
